﻿<?php

  /**
 *1901 Contact form module
 @package 1901 Contact form for Joomla! 1.6
 * @link       http://www.a.1901webdesign.com/
* @copyright (C) 2011- Nikolaos Koliopoulos
 * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
 */
 
 
 
 
defined('_JEXEC') or die('Restricted access');


JHTMLBehavior::formvalidation();


require_once (dirname(__FILE__).DS.'helper.php');


$loDoc =& JFactory::getDocument();
$loDoc->addScript(JURI::root().'modules'.DS.'mod_1901contact'.DS.'mod_1901contact.js');
$loDoc->addStyleSheet(JURI::root().'modules'.DS.'mod_1901contact'.DS.'mod_1901contact.css');


$lsSubmitText = $params->get('submit_button', 'Contact');
$lsStyleSuffix = $params->get('moduleclass_sfx', null);

$lsAction = JRequest::getVar('1901contactAction', null, 'POST');
if ($lsAction == 'send') {
    $lsMessage = mod1901contactHelper::sendEmail($params);
}


if (!isset($lsMessage)) $lsMessage = $params->get('introtext');

$credit = @$params->get( 'credit');
?>
<script language="javascript">
	function my1901contactValidate(f)
	{
		if (document.formvalidator.isValid(f)) {
			f.check.value='<?php echo JUtility::getToken(); ?>'; 
			return true; 
		} else {
			alert('Some values are not acceptable. Please retry.');
		}
		return false;
	}
</script>
<div id="1901contact"><?php echo $lsStyleSuffix; ?>
	<p><?php echo $lsMessage; ?></p>
	<form id="1901contactForm" method="post" class="form-validate" onSubmit="return my1901contactValidate(this);" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
		<input type="text" name="name" value="Your Name" onFocus="clear1901contactText(this)" class="inputtext" />
		<br />
		<input type="text" name="email" value="Email" onFocus="clear1901contactText(this)" class="1901contactText required validate-email" />
		<br />
		<input type="text" name="Phone" value="Phone" onFocus="clear1901contactText(this)" class="1901contactText" />
		<br />
		<textarea name="text" class="1901contactTextarea"></textarea>
		<br />
		<input type="submit" value="<?php echo $lsSubmitText; ?>" class="1901contactButton" />
		<input type="hidden" name="1901contactAction" value="send" />
		<input type="hidden" name="check" value="post" />
	</form>

